home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / M_MNDSRC.ZIP / MANDALA.ASM < prev    next >
Assembly Source File  |  1997-06-04  |  42KB  |  2,545 lines

  1. ; mandala source (c) 1996/97 by Gábor Papp [rod/mandula]
  2. ; contact me at s5001@sun10.vsz.bme.hu or rod@inf.bme.hu
  3. ; visit us at www.inf.bme.hu/~mandula
  4. ;
  5. ; this header must stay at the top of this file.
  6. ;
  7. ; this material is not freeware. you are allowed to copy it without
  8. ; restrictions for non-commercial use. no payment of any kind may be charged
  9. ; for this product or any combination of products or services including this
  10. ; product without the author's authorization and official written license.
  11. ; commercial use is strictly prohibited.
  12. ;
  13. ; you may only look at the source, you may not use it.
  14. ; you must not use this code or derivatives in your productions.
  15. ; you may use the algorithms in non commercial productions if you credit me.
  16.  
  17. .386
  18.  
  19. ;·····················[macro magic by hyp-x/mandula]·····················
  20.  
  21. open_seg=0
  22.  
  23. nowarn    res
  24. .close    macro
  25.     ife    open_seg-1
  26.         %intcls
  27.         purge    %intcls
  28.     endif
  29. open_seg=0
  30.     endm
  31.  
  32. .code    macro    segname
  33.     .close
  34.     ifb    <segname>
  35.         _text    segment para public use16 'code'
  36.             assume    cs:_text
  37.         %intcls    macro
  38.         _text    ends
  39.             endm
  40.         open_seg=1
  41.     else
  42.         segname    segment para public use16 'code'
  43.             assume    cs:&segname
  44.         %intcls    macro
  45.         segname    ends
  46.             endm
  47.         open_seg=1
  48.     endif
  49.     endm
  50.  
  51. .data    macro
  52.     .close
  53. _data    segment para public use16 'data'
  54. %intcls    macro
  55. _data    ends
  56.     endm
  57. open_seg=1
  58.     endm
  59.  
  60. .data?    macro
  61.     .close
  62. _bss    segment para public use16 'bss'
  63. %intcls    macro
  64. _bss    ends
  65.     endm
  66. open_seg=1
  67.     endm
  68.  
  69. .stack    macro size
  70.     .close
  71.     ifdef    mod_tiny
  72.         display "**error** tiny programs shouldn't have a stack."
  73.         err
  74.     else
  75.     nowarn  res
  76.  
  77. stack    segment para stack use16 'stack'
  78.     warn    res
  79.     ifb <size>
  80.     db    1024 dup(?)
  81.     else
  82.     db    size dup(?)
  83.     endif
  84. stack    ends
  85.     endif
  86.     endm
  87.  
  88. .fardata? macro    segname
  89.     .close
  90.     ifb    <segname>
  91.         display    "**error** far segment must have a name."
  92.         err
  93.     else
  94.         segname    segment para public use16 'far_bss'
  95.         %intcls    macro
  96.         segname    ends
  97.             endm
  98.         open_seg=1
  99.     endif
  100.     endm
  101.  
  102. end    macro startlabel
  103.     .close
  104.     purge    end
  105.     end startlabel
  106.     endm
  107.  
  108. %groupdef macro
  109.     ifdef    mod_nearstack
  110.         .data
  111.         .data?
  112.         .stack    0
  113.         group    dgroup    _data,_bss,stack
  114.         assume    ds:dgroup
  115.         @data    equ    dgroup
  116.         .close
  117.     else
  118.         .data
  119.         .data?
  120.         group    dgroup    _data,_bss
  121.         assume    ds:dgroup
  122.         @data    equ    dgroup
  123.         .close
  124.     endif
  125.     endm
  126. .model    macro model_def,stack_mod
  127.     ifidni    <stack_mod>,<nearstack>
  128.         mod_nearstack    equ    1
  129.     endif
  130.  
  131.     ifidni    <model_def>,<tiny>
  132.         mod_tiny    equ    1
  133.         .code
  134.         .data
  135.         .data?
  136.         group    com_group    text,data,bss
  137.         .close
  138.     else
  139.     ifidni     <model_def>,<small>
  140.         mod_small    equ    1
  141.         %groupdef
  142.     else
  143.         display    "**error** the model is not valid or not implemented."
  144.         err
  145.     endif
  146.     endif
  147.     endm
  148.  
  149. .name    macro    modulname
  150.     ifb    <modulname>
  151.         display "**error** modul definition must have a name."
  152.         err
  153.     else
  154.         _text    equ <modulname>
  155.     endif
  156.     endm
  157.  
  158. warn    res
  159. ;········································································
  160.  
  161. .model small
  162. .stack 256
  163. jumps
  164. locals
  165. dosseg
  166.  
  167. nowarn res
  168. ;········································································
  169. load        macro    para1,para2
  170.         push     para2
  171.         pop      para1
  172. endm
  173. ;········································································
  174. movfdd        macro    mem,data
  175.         mov    mem,012345678h
  176. org    $-4
  177. dd    data
  178. endm
  179.  
  180. ;············································································
  181. setalc        macro
  182.  
  183.         db    0d6h
  184.  
  185. endm
  186.  
  187. ;········································································
  188.  
  189. ;████████████████████████████████████████████████████████████████████████
  190.                 .fardata? @virtscr
  191. ;████████████████████████████████████████████████████████████████████████
  192.  
  193.         db      64000 dup (?)
  194.  
  195.  
  196. ;████████████████████████████████████████████████████████████████████████
  197.                 .fardata? @mazeseg
  198. ;████████████████████████████████████████████████████████████████████████
  199.  
  200.         db      65535 dup (?)
  201.  
  202. ;████████████████████████████████████████████████████████████████████████
  203.                 .fardata? @clouds
  204. ;████████████████████████████████████████████████████████████████████████
  205.  
  206.         db    64000 dup (?)
  207.  
  208. ;████████████████████████████████████████████████████████████████████████
  209.                 .fardata? @mandala
  210. ;████████████████████████████████████████████████████████████████████████
  211.  
  212.         db    65535 dup(?)
  213.  
  214. ;████████████████████████████████████████████████████████████████████████
  215.                 .fardata? @distabseg
  216. ;████████████████████████████████████████████████████████████████████████
  217.  
  218. distable    db    64000 dup(?)
  219.  
  220. ;████████████████████████████████████████████████████████████████████████
  221.                 .fardata? @circtabseg
  222. ;████████████████████████████████████████████████████████████████████████
  223.  
  224. circtable    db    64000 dup(?)
  225.  
  226. ;████████████████████████████████████████████████████████████████████████
  227.                 .fardata? @degtabseg
  228. ;████████████████████████████████████████████████████████████████████████
  229.  
  230. degtable    db    64000 dup (?)
  231.  
  232. ;████████████████████████████████████████████████████████████████████████
  233.                 .fardata? @multabseg
  234. ;████████████████████████████████████████████████████████████████████████
  235.  
  236. multable    db    65535 dup(?)
  237.  
  238. ;████████████████████████████████████████████████████████████████████████
  239.                 .data?
  240. ;████████████████████████████████████████████████████████████████████████
  241.  
  242. sintable        dw      64  dup(?)
  243. costable        dw      256 dup(?)
  244.  
  245. ;────────────────────────────────────────────────────────────────────────
  246.  
  247. palette         db      768 dup(?)
  248.  
  249. fadeinval    dw    ?
  250. fadeoutval    dw    ?
  251. mandinit    dw    ?
  252.  
  253. ;────────────────────────────────────────────────────────────────────────
  254.  
  255. dist            dw      200 dup(?)
  256. angle           dw      ?
  257. xpos            db      ?
  258. ypos            db      ?
  259.  
  260. ;────────────────────────────────────────────────────────────────────────
  261.  
  262. xc              dw      ?
  263. yc              dw      ?
  264. radius          dw      ?
  265. color           db      ?
  266.  
  267. ;────────────────────────────────────────────────────────────────────────
  268.  
  269. liney           dw      ?
  270. linexstart      dw      ?
  271. linexend        dw      ?
  272.  
  273. ;────────────────────────────────────────────────────────────────────────
  274. skyxstart       dw      ?
  275.  
  276. ;────────────────────────────────────────────────────────────────────────
  277.  
  278. timer           dd      ?
  279.  
  280. ;────────────────────────────────────────────────────────────────────────
  281.  
  282. deg        dw    ?
  283.  
  284. ;────────────────────────────────────────────────────────────────────────
  285.  
  286. x0        dq    ?
  287. x        dq    ?
  288. y        dq    ?
  289. addx        dq    ?
  290. addy        dq    ?
  291. bailout        dq    ?
  292.  
  293. r        dq    ?
  294. phi        dq    ?
  295. status        dw    ?
  296.  
  297. ;────────────────────────────────────────────────────────────────────────
  298.  
  299.         dd    ?
  300. fire        db      32*16 dup (?)
  301.         dd    ?
  302.  
  303. ;────────────────────────────────────────────────────────────────────────
  304.  
  305. balldata1    dw    32*32 dup (?)
  306. balldata2    dw    32*32 dup (?)
  307. balldata3    dw    32*32 dup (?)
  308. balldata4    dw    32*32 dup (?)
  309. balldata5    dw    32*32 dup (?)
  310. balldata6    dw    32*32 dup (?)
  311. balldata7    dw    32*32 dup (?)
  312.  
  313. balloffsets    dw    7     dup (?)
  314.  
  315. sqr        dw    ?
  316. ddtemp        dd    ?
  317. dwtemp        dw    ?
  318.  
  319. ;────────────────────────────────────────────────────────────────────────
  320.  
  321. alpha        dw    ?
  322. beta            dw      ?
  323. gamma           dw      ?
  324.  
  325. sinalpha    dw    ?
  326.  
  327. r11        dw    ?
  328. r12        dw      ?
  329. r13        dw      ?
  330. r21        dw    ?
  331. r22        dw      ?
  332. r23        dw      ?
  333. r31        dw    ?
  334. r32        dw      ?
  335. r33        dw      ?
  336.  
  337. add11        dw    ?
  338. add12        dw    ?
  339.  
  340. ;────────────────────────────────────────────────────────────────────────
  341.  
  342. np=19
  343. addxball=160
  344. addyball=100
  345. addzball=600
  346.  
  347. db    ?
  348. dw    ?
  349.  
  350. object          dw    np-2 dup(?,?,?)
  351.  
  352.  
  353. currentobject    dw    np dup(?,?,?)
  354.  
  355.         align    4
  356.  
  357. zlist        dw    np dup(?,?)
  358.  
  359. ballx        dw    ?
  360. bally        dw    ?
  361.  
  362. fireinit    dw    ?
  363.  
  364. ;────────────────────────────────────────────────────────────────────────
  365.  
  366. sz255        dd    ?
  367. stripeinit    dw    ?
  368. morph        dw    ?
  369.  
  370. ;────────────────────────────────────────────────────────────────────────
  371.  
  372. fpu_cw        dw    ?
  373.  
  374. ;────────────────────────────────────────────────────────────────────────
  375.  
  376. t_fadeleft    =     128
  377. t_left       =     450
  378. t_right        =     850
  379. t_faderight    =     978
  380.  
  381. t_mandalain    =    1106
  382. t_mandala    =       1600
  383. t_mandalaout    =    1728
  384.  
  385. t_stripein    =    1856
  386. t_stripe    =       2300
  387. t_stripeout    =    2428
  388.  
  389. t_firein    =    2556
  390. t_fireballs    =    3600
  391. t_fireout    =    3728
  392.  
  393. ;████████████████████████████████████████████████████████████████████████
  394.                 .code
  395.                 .386
  396.                 .387
  397. ;████████████████████████████████████████████████████████████████████████
  398.  
  399. main            proc    near
  400.  
  401.         pop    ax
  402.  
  403.         fninit
  404.  
  405.         mov    cx,2
  406.         loop    $
  407.  
  408.         fnstcw    fpu_cw
  409.         cmp    byte ptr [fpu_cw+1],3
  410.         jne    @@out
  411.  
  412.  
  413.         in    al,21h
  414.         or    al,6
  415.         out    21h,al
  416.  
  417.         call    genmaze
  418.  
  419.         load    es,0
  420.         cli
  421.         mov     eax,es:[4*8]
  422.         mov     cs:oldint8,eax
  423.         lea     bx,cs:newint8
  424.         mov     es:[4*8],bx
  425.         mov     es:[4*8+2],cs
  426.  
  427.         mov     al,36h
  428.         out     43h,al
  429.         mov     ax,428bh
  430.         out     40h,al
  431.         mov     al,ah
  432.         out     40h,al
  433.  
  434.         sti
  435.  
  436.  
  437.         load    ds,@data
  438.         call    gensintable
  439.         call    initwave
  440.         call    mandala
  441.  
  442.  
  443.         load    es,ds
  444.         lea    di,fire-4
  445.         mov    cx,32*16/2+4
  446.         xor    ax,ax
  447.         rep    stosw
  448.  
  449.         mov    radius,14
  450.         mov    cx,7
  451.         lea    di,balldata1
  452.         xor    bx,bx
  453. @@transfcalc:   mov    balloffsets[bx],di
  454.         push    cx bx
  455.         call    balltransform
  456.         pop    bx cx
  457.         add    bx,2
  458.         dec    radius
  459.         loop    @@transfcalc
  460.  
  461.  
  462.         push    ds
  463.         load    es,ds
  464.         load    ds,cs
  465.         lea    si,cubes
  466.         lea    di,object
  467.         mov    cx,np*3*2
  468.         rep    movsb
  469.         pop    ds
  470.  
  471.  
  472.         mov     ax,13h
  473.         int     10h
  474.         call    genlogo
  475.         call    genclouds
  476.  
  477. ;────────────────────────────────────────────────────────────────────────
  478.  
  479.         xor    eax,eax
  480.  
  481.         mov    dword ptr alpha,eax
  482.         mov    gamma,ax
  483.  
  484.         mov     skyxstart,ax
  485.         mov     angle,ax
  486.         mov     word ptr xpos,ax
  487.  
  488.         mov    timer,eax
  489.         mov    fadeinval,ax
  490.         mov    mandinit,ax
  491.         mov    stripeinit,ax
  492.         mov    deg,ax
  493.         mov    fireinit,ax
  494.  
  495. @@timingeffects:mov     eax,timer
  496.  
  497.         cmp    eax,t_fadeleft
  498.         jb    @@fadeleft
  499.  
  500.         cmp    eax,t_left
  501.         jb    @@toleft
  502.  
  503.         cmp    eax,t_right
  504.         jb    @@toright
  505.  
  506.         cmp    eax,t_faderight
  507.         jb    @@faderight
  508.  
  509.         cmp    mandinit,0
  510.         je    @@mandinit
  511.  
  512.         cmp    eax,t_mandalain
  513.         jb    @@mandalain
  514.  
  515.         cmp    eax,t_mandala
  516.         jb    @@mandala
  517.  
  518.         cmp    eax,t_mandalaout
  519.         jb    @@mandalaout
  520.  
  521.         cmp    stripeinit,0
  522.         je    @@stripeinit
  523.  
  524.         cmp    eax,t_stripein
  525.         jb    @@stripein
  526.  
  527.         cmp    eax,t_stripe
  528.         jb    @@stripe
  529.  
  530.         cmp    eax,t_stripeout
  531.         jb    @@stripeout
  532.  
  533.         cmp    fireinit,0
  534.         je    @@fireinit
  535.  
  536.         cmp    eax,t_firein
  537.         jb    @@firein
  538.  
  539.         mov    word ptr cs:fireroot,0bfbfh
  540.  
  541.         cmp    eax,t_fireballs
  542.         jb    @@fireballs
  543.  
  544.         mov    word ptr cs:fireroot,0h
  545.  
  546.         cmp    eax,t_fireout
  547.         jb    @@fireout
  548.  
  549.         jmp    @@todos
  550.  
  551.  
  552. @@fadeleft:
  553.         mov    bp,fadeinval
  554.         call    fade
  555.  
  556. @@toleft:
  557.         load    es,@virtscr
  558.         call    sky
  559.         call    drawmaze
  560.         call    drawvirt
  561.  
  562.         inc     skyxstart
  563.         inc     byte ptr angle
  564.         add     xpos,2
  565.         add     ypos,2
  566.  
  567.  
  568.         jmp    @@endeffect
  569.  
  570. ;────────────────────────────────────────────────────────────────────────
  571.  
  572. @@faderight:
  573.         mov    bp,fadeoutval
  574.         call    fade
  575.  
  576. @@toright:    cmp    timer,t_right
  577.         ja    @@nomax
  578.         mov    fadeoutval,128
  579. @@nomax:
  580.         load    es,@virtscr
  581.         call    sky
  582.         call    drawmaze
  583.         call    drawvirt
  584.  
  585.  
  586.         dec     skyxstart
  587.         dec     byte ptr angle
  588.         sub     xpos,2
  589.         add     ypos,4
  590.  
  591.         mov    fadeinval,0
  592.  
  593.         jmp    @@endeffect
  594.  
  595. ;────────────────────────────────────────────────────────────────────────
  596.  
  597. @@stripeinit:   lea    si,cs:stripepal
  598.         call    fillpalette
  599.  
  600.         push    es
  601.         call    stripes
  602.  
  603.         load    es,0a000h
  604.         mov    cx,32000
  605.         xor    ax,ax
  606.         xor    di,di
  607.         rep    stosw
  608.         pop    es
  609.  
  610.         mov    dword ptr cs:shadepatch1,0100878ah
  611.         mov    dword ptr cs:shadepatch2,0100a78ah
  612.  
  613.         mov    stripeinit,1
  614.         mov    fadeinval,0
  615.  
  616. @@stripein:
  617.         mov    bp,fadeinval
  618.         call    fade
  619.         jmp    @@stripe
  620.  
  621. @@stripeout:
  622.         mov    bp,fadeoutval
  623.         call    fade
  624.         jmp    @@stripewave
  625.  
  626.  
  627. @@stripe:    mov    fadeoutval,128
  628.  
  629. @@stripewave:    mov    morph,20
  630.         call    distabgen
  631.  
  632.         load    fs,@distabseg
  633.         jmp    @@mandalawave
  634.  
  635. ;────────────────────────────────────────────────────────────────────────
  636.  
  637. @@mandinit:     lea    si,cs:mandalapal
  638.         call    fillpalette
  639.  
  640.         mov    cx,32000
  641.         xor    ax,ax
  642.         xor    di,di
  643.         rep    stosw
  644.         mov    mandinit,1
  645.  
  646. @@mandalain:
  647.         mov    bp,fadeinval
  648.         call    fade
  649.         jmp    @@mandala
  650.  
  651. @@mandalaout:
  652.         mov    bp,fadeoutval
  653.         call    fade
  654.  
  655. @@mandala:
  656.         load    fs,@circtabseg
  657.         cmp    timer,t_mandala
  658.         ja    @@mandalawave
  659.         mov    fadeoutval,128
  660.  
  661.  
  662. @@mandalawave:    load    gs,@mandala
  663.  
  664.  
  665.         push    es
  666.         load    es,@multabseg
  667.  
  668.         mov    cx,256
  669.         xor    di,di
  670.         mov    si,deg
  671.         add    si,si
  672.  
  673. @@0:            mov    ax,ds:sintable[si]
  674.  
  675.         push    ax
  676.         mov    bl,16
  677.  
  678.         sar    ax,4
  679.  
  680.         neg    al
  681.  
  682.         mov    es:[di+256],al
  683.         pop    ax
  684.  
  685.         sar    ax,5
  686.         add    ax,128
  687.         stosb
  688.  
  689.         add    si,8
  690.         and    si,511
  691.         loop    @@0
  692.  
  693.         pop    es
  694.  
  695.         sub    byte ptr deg,5
  696.  
  697.         call    wave
  698.         call    waitrtc
  699.  
  700.         jmp    @@endeffect
  701.  
  702. ;────────────────────────────────────────────────────────────────────────
  703.  
  704. @@fireinit:     call    wood
  705.  
  706.         lea    si,cs:firepal
  707.         call    fillpalette
  708.  
  709.         mov    fadeinval,0
  710.         mov    fireinit,1
  711.  
  712. @@firein:
  713.         mov    bp,fadeinval
  714.         call    fade
  715.         jmp    @@fireballs
  716.  
  717. @@fireout:
  718.         mov    bp,fadeoutval
  719.         call    fade
  720.  
  721. @@fireballs:    cmp    timer,t_fireballs
  722.         ja    @@goballs
  723.         mov    fadeoutval,128
  724.  
  725. @@goballs:    call    makefire
  726.  
  727.         push    ds
  728.         load    es,@virtscr
  729.         load    ds,@mazeseg
  730.         xor    di,di
  731.         xor    si,si
  732.         mov    cx,32000
  733.         rep    movsw
  734.         pop    ds
  735.  
  736.  
  737.         call    drawobject
  738.         call    drawvirt
  739.  
  740.  
  741.         add    byte ptr alpha,1
  742.         add    byte ptr beta,-2
  743.         add    byte ptr gamma,1
  744.  
  745.  
  746.         jmp    @@endeffect
  747.  
  748.  
  749. @@endeffect:    in    al,60h
  750.         dec    al
  751.         jnz    @@timingeffects
  752.  
  753.  
  754. ;────────────────────────────────────────────────────────────────────────
  755.  
  756. @@todos:        in    al,21h
  757.         and    al,255-6
  758.         out    21h,al
  759.  
  760.         mov    ah,1
  761.         int    16h
  762.         jz    @@pufferisempty
  763.  
  764.         xor    ax,ax
  765.         int    16h
  766.  
  767. @@pufferisempty:
  768.  
  769.         load    es,0
  770.         cli
  771.         mov     eax,cs:oldint8
  772.         mov     es:[4*8],eax
  773.  
  774.         mov     al,36h
  775.         out     43h,al
  776.         xor     ax,ax
  777.         out     40h,al
  778.         out     40h,al
  779.  
  780.         sti
  781.  
  782.         mov     ax,3
  783.         int     10h
  784.  
  785. @@out:        load    ds,cs
  786.         lea    dx,cs:endmessage
  787.         mov    ah,9
  788.         int    21h
  789.  
  790.         mov     ax,4c00h
  791.         int     21h
  792.  
  793. endmessage    db    "(c) 1996/97 by rod/mandula",13,10,'$'
  794.  
  795.  
  796. main            endp
  797.  
  798. ;────────────────────────────────────────────────────────────────────────
  799. wave        proc    near
  800. ;────────────────────────────────────────────────────────────────────────
  801.  
  802.         push    ds
  803.         load    ds,@multabseg
  804.  
  805.         mov    di,32
  806.  
  807.         mov    dh,0
  808. @@yloop:    mov    dl,0
  809.  
  810. @@xloop:
  811.         mov    cx,word ptr fs:distable[di]
  812.         mov    bl,cl
  813.         mov    bh,0
  814.  
  815. shadepatch1:    mov    al,0
  816.         nop
  817.         nop
  818.  
  819.         mov    bh,[bx]
  820.         mov    bl,dl
  821.         mov    cl,[bx]
  822.         mov    bl,dh
  823.         mov    bh,[bx]
  824.         mov    bl,cl
  825.         add    al,gs:[bx+7168]
  826.  
  827.         inc    dl
  828.  
  829.  
  830.         mov    bl,ch
  831.         mov    bh,0
  832. shadepatch2:    mov    ah,0
  833.         nop
  834.         nop
  835.  
  836.         mov    bh,[bx]
  837.         mov    bl,dl
  838.         mov    ch,[bx]
  839.         mov    bl,dh
  840.         mov    bh,[bx]
  841.         mov    bl,ch
  842.         add    ah,gs:[bx+7168]
  843.  
  844.         mov    es:[di],ax
  845.  
  846.         inc    dl
  847.         add    di,2
  848.  
  849.  
  850.         cmp    dl,0
  851.         jne    @@xloop
  852.  
  853.  
  854.         add    di,320-256
  855.         inc    dh
  856.         cmp    dh,200
  857.         jne    @@yloop
  858.  
  859.         pop    ds
  860.         ret
  861.  
  862. wave        endp
  863.  
  864.  
  865.  
  866. ;────────────────────────────────────────────────────────────────────────
  867. distabgen    proc    near
  868. ;────────────────────────────────────────────────────────────────────────
  869.  
  870.         mov    ax,deg
  871.         mov    cs:byte ptr @@patch+2,al
  872.  
  873.         push    es fs gs
  874.  
  875.         load    fs,@degtabseg
  876.         load    gs,@circtabseg
  877.         load    es,@distabseg
  878.  
  879.         mov    di,63999
  880.  
  881.         mov    dx,morph
  882.  
  883. @@loop:         mov    cl,gs:[di]
  884.         mov    bl,fs:[di]
  885.  
  886. @@patch:        add    bl,0ffh
  887.  
  888.         mov    bh,0
  889.         add    bx,bx
  890.         mov    ax,ds:sintable[bx]
  891.         idiv    dl
  892.  
  893.         add    al,cl
  894.         mov    es:[di],al
  895.         dec    di
  896.         jnz    @@loop
  897.  
  898.         pop    gs fs es
  899.  
  900.         ret
  901.  
  902.  
  903. distabgen    endp
  904.  
  905.  
  906. ;────────────────────────────────────────────────────────────────────────
  907. stripes        proc    near
  908. ;────────────────────────────────────────────────────────────────────────
  909.  
  910.         load    es,@mandala
  911.         xor    di,di
  912.         mov    cx,32768
  913.         xor    ax,ax
  914.         rep    stosw
  915.  
  916.         xor    si,si
  917.  
  918.         xor    cx,cx
  919.         xor    di,di
  920. @@1:
  921.         mov    ax,15
  922.         call    random
  923.         inc    ax
  924.  
  925.         mov    bx,cs:ctable[si-2]
  926.         mov    ah,es:[di+bx]
  927.         mov    bx,cs:ctable[si]
  928.         add    ah,es:[di+bx]
  929.         shr    ah,1
  930.         add    al,ah
  931.         add    al,16
  932.         stosb
  933.  
  934.         add    si,2
  935.         and    si,15
  936.  
  937.         dec    cx
  938.         jnz    @@1
  939.  
  940.         ret
  941.  
  942. stripes        endp
  943.  
  944.         dw    -257
  945. ctable        dw    -256,-255,1,257,256,255,-1,-257
  946.  
  947.  
  948.  
  949. ;────────────────────────────────────────────────────────────────────────
  950. drawobject    proc    near
  951. ;────────────────────────────────────────────────────────────────────────
  952.  
  953.         load    es,ds
  954.  
  955.         call    calcrot
  956.  
  957.         lea    si,ds:object
  958.         lea    di,ds:currentobject
  959.         mov    cx,np
  960.         call    rotatexyz
  961.  
  962.  
  963.         mov    cx,np
  964.         lea    si,ds:currentobject
  965.         lea    di,ds:zlist
  966. @@fillzlist:    mov     ax,ds:[si+4]
  967.         neg    ax
  968.         stosw
  969.         mov    ax,si
  970.         stosw
  971.         add    si,6
  972.         loop    @@fillzlist
  973.  
  974.  
  975.  
  976.         lea    cx,ds:zlist
  977.         lea    dx,ds:zlist+(np-1)*4
  978.         call    qsort
  979.  
  980.         mov    cx,np
  981.         lea    si,zlist
  982.  
  983.         load    es,@virtscr
  984.  
  985. @@perspective:
  986.         mov    di,[si+2]
  987.  
  988.         mov    bx,ds:[di+4]
  989.         add    bx,addzball
  990.         mov     ax,ds:[di]
  991.         cwd
  992.         mov    dl,ah
  993.         mov    ah,al
  994.         mov    al,0
  995.         idiv    bx
  996.         add    ax,addxball
  997.         mov    ballx,ax
  998.  
  999.         mov     ax,ds:[di+2]
  1000.         cwd
  1001.         mov    dl,ah
  1002.         mov    ah,al
  1003.         mov    al,0
  1004.         idiv    bx
  1005.         add    ax,addyball
  1006.         mov    bally,ax
  1007.  
  1008.         pusha
  1009.  
  1010.         sub    bx,400
  1011.         sar    bx,6
  1012.         call    drawfireball
  1013.  
  1014.         popa
  1015.  
  1016.         add    si,4
  1017.  
  1018.         loop    @@perspective
  1019.  
  1020.  
  1021.         ret
  1022.  
  1023. drawobject    endp
  1024.  
  1025. ;────────────────────────────────────────────────────────────────────────
  1026. qsort        proc    near
  1027. ;────────────────────────────────────────────────────────────────────────
  1028.         mov    bx,cx
  1029.         add    bx,dx
  1030.         rcr    bx,1
  1031.         and    bx,0FFFCh
  1032.  
  1033.         mov    si,cx
  1034.         mov    di,dx
  1035.  
  1036.         mov    bx,ds:[bx]
  1037.         sub    si,4
  1038.         add    di,4
  1039. @@repeat:
  1040. @@while_i:
  1041.         add    si,4
  1042.         cmp    ds:[si],bx
  1043.         jl    @@while_i
  1044. @@while_j:
  1045.         sub    di,4
  1046.         cmp    ds:[di],bx
  1047.         jg    @@while_j
  1048.         cmp    si,di
  1049.         jae    @@break
  1050.         mov    eax,ds:[si]
  1051.         mov    ebp,ds:[di]
  1052.         mov    ds:[si],ebp
  1053.         mov    ds:[di],eax
  1054.         jmp    @@repeat
  1055. @@break:
  1056.         sub    si,4
  1057.         add    di,4
  1058.  
  1059.         cmp    cx,si
  1060.         jae    @@noleft
  1061.         push    dx di
  1062.         mov    dx,si
  1063.         call    qsort
  1064.         pop    di dx
  1065. @@noleft:
  1066.         cmp    di,dx
  1067.         jae    @@noright
  1068.         mov    cx,di
  1069.         call    qsort
  1070. @@noright:
  1071.         ret
  1072.  
  1073. qsort    endp
  1074.  
  1075. ;────────────────────────────────────────────────────────────────────────
  1076. drawfireball    proc     near
  1077. ;────────────────────────────────────────────────────────────────────────
  1078.  
  1079.         sub    ballx,16
  1080.         sub    bally,16
  1081.  
  1082.         add    bx,bx
  1083.         mov    si,balloffsets[bx]
  1084.  
  1085.         mov    ax,bally
  1086.         shl    ax,6
  1087.         mov    di,ax
  1088.         shl    ax,2
  1089.         add    di,ax
  1090.         add    di,ballx
  1091.  
  1092.         mov    dx,32
  1093. @@yloop:    mov    cx,32
  1094. @@xloop:    mov    bx,ds:[si]
  1095.         mov    al,fire[bx]
  1096.         or    al,al
  1097.         jz    @@black
  1098.         mov    es:[di],al
  1099.  
  1100.         mov    al,es:[di+320*5+10]
  1101.         cmp    al,192+12
  1102.         jb    @@black
  1103.  
  1104.         sub    byte ptr es:[di+320*5+10],12
  1105.  
  1106. @@black:    inc    di
  1107.         add    si,2
  1108.         loop    @@xloop
  1109.         add    di,320-32
  1110.  
  1111.         dec    dx
  1112.         jnz    @@yloop
  1113.  
  1114.         ret
  1115.  
  1116. drawfireball    endp
  1117.  
  1118. ;────────────────────────────────────────────────────────────────────────
  1119. balltransform   proc     near
  1120. ;────────────────────────────────────────────────────────────────────────
  1121.  
  1122.         load    es,ds
  1123.         cld
  1124.         finit
  1125.  
  1126.         mov    dx,-16
  1127. @@yloop:    mov    cx,-16
  1128.         mov    bx,dx
  1129.         imul    bx,bx
  1130.         mov    bally,dx
  1131. @@xloop:
  1132.         mov    ballx,cx
  1133.         or    cx,cx
  1134.         jne    @@notzero
  1135.         cmp    dx,0
  1136.         jge    @@ygr0
  1137.         fldpi
  1138.         fld1
  1139.         fld1
  1140.         fadd
  1141.  
  1142.         fdiv
  1143.         jmp    @@morecalc
  1144.  
  1145. @@ygr0:         fldpi
  1146.         movfdd    ddtemp,1.5
  1147.         fld    ddtemp
  1148.         fmul
  1149.         jmp    @@morecalc
  1150.  
  1151.  
  1152. @@notzero:    fild    bally
  1153.         fild    ballx
  1154.         fpatan
  1155.         fldpi
  1156.         fadd
  1157.  
  1158. @@morecalc:     mov    dwtemp,32
  1159.         fild    dwtemp
  1160.         fmul
  1161.         fldpi
  1162.         fdiv
  1163.  
  1164.         fistp    dwtemp
  1165.  
  1166.         mov    ax,cx
  1167.         imul    ax,ax
  1168.         add    ax,bx
  1169.         mov    sqr,ax
  1170.         fild    sqr
  1171.         fsqrt
  1172.         fistp    sqr
  1173.  
  1174.         mov    ax,sqr
  1175.         cmp    ax,radius
  1176.         ja    @@black
  1177.  
  1178.         sub    ax,radius
  1179.         neg    ax
  1180.         shl    ax,5
  1181.         add    ax,dwtemp
  1182.         jmp    @@store
  1183.  
  1184. @@black:    xor    ax,ax
  1185. @@store:    stosw
  1186.         inc     cx
  1187.         cmp    cx,16
  1188.         jl    @@xloop
  1189.  
  1190.         inc    dx
  1191.         cmp    dx,16
  1192.         jl    @@yloop
  1193.  
  1194.         ret
  1195.  
  1196. balltransform   endp
  1197.  
  1198. ;────────────────────────────────────────────────────────────────────────
  1199. makefire    proc    near
  1200. ;────────────────────────────────────────────────────────────────────────
  1201.  
  1202. decay = 30
  1203.         load    es,ds
  1204.  
  1205.  
  1206.         lea    si,fire+32
  1207.         lea    di,fire
  1208.         mov    cx,32*16
  1209.  
  1210. @@actflame:     lodsb
  1211.         or    al,al
  1212.         jz    @@black
  1213.  
  1214.         cmp    al,decay
  1215.         jb    @@black
  1216.  
  1217.  
  1218.         mov    dl,al
  1219.         mov    ax,7
  1220.         call    random
  1221.         sub    ax,3
  1222.         mov    bx,ax
  1223.         mov    ax,decay
  1224.         call    random
  1225.         sub    dl,al
  1226.         mov    [di+bx],dl
  1227.         inc    di
  1228.         loop    @@actflame
  1229.         jmp    @@actflameready
  1230.  
  1231. @@black:        mov    byte ptr [di],0
  1232.         inc    di
  1233.         loop    @@actflame
  1234.  
  1235. @@actflameready:
  1236.         mov    fire[0],0
  1237.  
  1238.  
  1239.         lea    di,fire+15*32
  1240.         mov    ax,0
  1241.  
  1242. fireroot = $ - 2
  1243.  
  1244.         mov    cx,16
  1245.         rep    stosw
  1246.  
  1247.         ret
  1248.  
  1249. makefire    endp
  1250.  
  1251. ;────────────────────────────────────────────────────────────────────────
  1252. calcrot        proc    near
  1253. ;────────────────────────────────────────────────────────────────────────
  1254.  
  1255.         mov    bx,alpha
  1256.         add    bx,bx
  1257.         mov    ax,sintable[bx]
  1258.         mov    sinalpha,ax
  1259.         mov    di,costable[bx]
  1260.  
  1261.         mov    bx,beta
  1262.         add    bx,bx
  1263.         mov    si,sintable[bx]
  1264.         mov    bp,costable[bx]
  1265.  
  1266.         mov    bx,gamma
  1267.         add    bx,bx
  1268.         mov    cx,sintable[bx]
  1269.         mov    ax,costable[bx]
  1270.         mov    bx,ax
  1271.  
  1272.         imul    bp
  1273.         shrd    ax,dx,8
  1274.         mov    r11,ax
  1275.  
  1276.         mov    ax,cx
  1277.         imul    bp
  1278.         shrd    ax,dx,8
  1279.         mov    r12,ax
  1280.  
  1281.         mov    ax,si
  1282.         mov    r13,ax
  1283.         neg    r13
  1284.  
  1285.         mov    ax,di
  1286.         imul    cx
  1287.         shrd    ax,dx,8
  1288.         mov    add11,ax
  1289.  
  1290.         mov    ax,sinalpha
  1291.         imul    bx
  1292.         shrd    ax,dx,8
  1293.         mov    add12,ax
  1294.         imul    si
  1295.         shrd    ax,dx,8
  1296.         sub    ax,add11
  1297.  
  1298.         mov    r21,ax
  1299.  
  1300.         mov    ax,add11
  1301.         imul    si
  1302.         shrd    ax,dx,8
  1303.         sub    ax,add12
  1304.         mov    r32,ax
  1305.  
  1306.         mov    ax,di
  1307.         imul    bx
  1308.         shrd    ax,dx,8
  1309.         mov    add11,ax
  1310.  
  1311.         mov    ax,sinalpha
  1312.         imul    cx
  1313.         shrd    ax,dx,8
  1314.         mov    add12,ax
  1315.         imul    si
  1316.         shrd    ax,dx,8
  1317.         add    ax,add11
  1318.         mov    r22,ax
  1319.  
  1320.         mov    ax,add11
  1321.         imul    si
  1322.         shrd    ax,dx,8
  1323.         add    ax,add12
  1324.         mov    r31,ax
  1325.  
  1326.         mov    ax,sinalpha
  1327.         imul    bp
  1328.         shrd    ax,dx,8
  1329.         mov    r23,ax
  1330.  
  1331.         mov    ax,di
  1332.         imul    bp
  1333.         shrd    ax,dx,8
  1334.  
  1335.         mov    r33,ax
  1336.  
  1337.         ret
  1338.  
  1339. calcrot        endp
  1340.  
  1341. ;────────────────────────────────────────────────────────────────────────
  1342. rotatexyz    proc    near
  1343. ;────────────────────────────────────────────────────────────────────────
  1344.  
  1345. @@rotxyz:       mov    ax,r12
  1346.         imul    word ptr ds:[si]
  1347.         shrd    ax,dx,8
  1348.         mov    bx,ax
  1349.  
  1350.         mov    ax,r22
  1351.         imul    word ptr ds:[si+2]
  1352.         shrd    ax,dx,8
  1353.         add    bx,ax
  1354.  
  1355.         mov    ax,r32
  1356.         imul    word ptr ds:[si+4]
  1357.         shrd    ax,dx,8
  1358.         add    ax,bx
  1359.         mov    ds:[di+2],ax
  1360.  
  1361.         mov    ax,r11
  1362.         imul    word ptr ds:[si]
  1363.         shrd    ax,dx,8
  1364.         mov    bx,ax
  1365.  
  1366.         mov    ax,r21
  1367.         imul    word ptr ds:[si+2]
  1368.         shrd    ax,dx,8
  1369.         add    bx,ax
  1370.  
  1371.         mov    ax,r31
  1372.         imul    word ptr ds:[si+4]
  1373.         shrd    ax,dx,8
  1374.         add    ax,bx
  1375.         mov    ds:[di],ax
  1376.  
  1377.         mov    ax,r13
  1378.         imul    word ptr ds:[si]
  1379.         shrd    ax,dx,8
  1380.         mov    bx,ax
  1381.  
  1382.         mov    ax,r23
  1383.         imul    word ptr ds:[si+2]
  1384.         shrd    ax,dx,8
  1385.         add    bx,ax
  1386.  
  1387.         mov    ax,r33
  1388.         imul    word ptr ds:[si+4]
  1389.         shrd    ax,dx,8
  1390.         add    ax,bx
  1391.         mov    ds:[di+4],ax
  1392.  
  1393.         add    di,6
  1394.         add    si,6
  1395.         dec    cx
  1396.         jnz    @@rotxyz
  1397.  
  1398.         ret
  1399.  
  1400. rotatexyz    endp
  1401.  
  1402.  
  1403. ;────────────────────────────────────────────────────────────────────────
  1404. wood        proc    near
  1405. ;────────────────────────────────────────────────────────────────────────
  1406.  
  1407.         push    ds
  1408.         load    ds,@mazeseg
  1409.         load    es,ds
  1410.  
  1411.         xor    di,di
  1412.         mov    ax,0e1e0h
  1413.         mov    cx,32000
  1414.         rep    stosw
  1415.  
  1416.         xor    cx,cx
  1417.         xor    bp,bp
  1418. @@woo:        mov    ax,bp
  1419.         add    bp,bx
  1420.         and    ax,7
  1421.  
  1422.         mov    bl,[di-320]
  1423.         or    al,al
  1424.         jz    @@0
  1425.         dec    al
  1426.         jz    @@1
  1427.         dec    al
  1428.         jz    @@2
  1429.         dec    al
  1430.         jz    @@3
  1431.  
  1432. @@4:        mov    [di],bl
  1433.         inc    di
  1434.         loop    @@woo
  1435.  
  1436.         pop    ds
  1437.  
  1438.         ret
  1439.  
  1440. @@0:        cmp    bl,253
  1441.         ja    @@4
  1442.         inc    bl
  1443. @@01:        inc    bl
  1444.         jmp    @@4
  1445.  
  1446. @@1:        cmp    bl,194
  1447.         jb    @@4
  1448.         dec    bl
  1449. @@11:        dec    bl
  1450.         jmp    @@4
  1451.  
  1452. @@2:        cmp    bl,[di-321]
  1453. @@21:        je    @@4
  1454.         jb    @@01
  1455.         jmp    @@11
  1456.  
  1457. @@3:        cmp    bl,[di-319]
  1458.         jmp    @@21
  1459.  
  1460. wood        endp
  1461.  
  1462. ;────────────────────────────────────────────────────────────────────────
  1463. mandala        proc    near
  1464. ;────────────────────────────────────────────────────────────────────────
  1465.  
  1466.         load    es,ds
  1467.         load    ds,cs
  1468.         lea    si,mandata
  1469.         lea    di,x0
  1470.         mov    cx,48
  1471.         rep    movsw
  1472.  
  1473.         load    ds,es
  1474.  
  1475.         load    es,@mandala
  1476.  
  1477.  
  1478.         fninit
  1479.  
  1480.         mov    bx,85
  1481.         xor    di,di
  1482. @@yloop:
  1483.         fld    x0
  1484.         fstp    x
  1485.         mov    dx,85
  1486.  
  1487. @@xloop:
  1488.         fld    x
  1489.         fmul    x
  1490.         fld    y
  1491.         fmul    y
  1492.         fadd
  1493.         fsqrt
  1494.         fstp    r
  1495.         fld    y
  1496.         fld    x
  1497.         fpatan
  1498.         fstp    phi
  1499.  
  1500.         xor    cx,cx
  1501.  
  1502. @@iter:        inc    cx
  1503.  
  1504.         fld1
  1505.         fdiv    r
  1506.         fld    st(0)
  1507.         fmul
  1508.         fst    r
  1509.  
  1510.         fld    phi
  1511.         fadd    phi
  1512.         fchs
  1513.         fstp    phi
  1514.  
  1515.         fcomp    bailout
  1516.  
  1517.         fnstsw    status
  1518.  
  1519.         test    byte ptr status+1,01000101b
  1520.         jz    @@out
  1521.  
  1522.         jmp    @@iter
  1523.  
  1524. @@out:        fld    phi
  1525.         fsin
  1526.         fmul    r
  1527.         frndint
  1528.         fistp    status
  1529.         shl    cx,3
  1530.         add    cx,status
  1531.         cmp    cx,256
  1532.         jb    @@iterout
  1533.         mov    cl,0
  1534. @@iterout:    mov    ch,cl
  1535.  
  1536.         mov    es:[di],cl
  1537.         mov    es:[di+85],cl
  1538.         mov    es:[di+85*2],cx
  1539.  
  1540.         mov    es:[di+256*85],cl
  1541.         mov    es:[di+256*85+85],cl
  1542.         mov    es:[di+256*85+85*2],cx
  1543.  
  1544.         mov    es:[di+256*85*2],cl
  1545.         mov    es:[di+256*85*2+85],cl
  1546.         mov    es:[di+256*85*2+85*2],cx
  1547.  
  1548.         mov    es:[di+256*85*3],cl
  1549.         mov    es:[di+256*85*3+85],cl
  1550.         mov    es:[di+256*85*3+85*2],cx
  1551.  
  1552.  
  1553.         fld    x
  1554.         fadd    addx
  1555.         fstp    x
  1556.  
  1557.         inc    di
  1558.         dec    dx
  1559.         jnz    @@xloop
  1560.  
  1561.         add    di,256-85
  1562.         fld    y
  1563.         fadd    addy
  1564.         fstp    y
  1565.  
  1566.         dec    bx
  1567.         jnz    @@yloop
  1568.  
  1569.         ret
  1570.  
  1571. mandala        endp
  1572.  
  1573. ;────────────────────────────────────────────────────────────────────────
  1574.  
  1575. mandata        dq    -1.7473876,-1.7473876,1.72384644,0.0415735
  1576.         dq    -0.0410288,8.0
  1577.  
  1578. ;────────────────────────────────────────────────────────────────────────
  1579. initwave    proc    near
  1580. ;────────────────────────────────────────────────────────────────────────
  1581.  
  1582.         load    fs,@circtabseg
  1583.         load    es,@degtabseg
  1584.         xor    di,di
  1585.  
  1586.         movfdd    sz255,1275.0
  1587.  
  1588.         mov    dx,-100
  1589. @@yloop:    mov    cx,-160
  1590.         mov    bx,dx
  1591.         imul    bx,bx
  1592. @@xloop:    mov    ax,cx
  1593.         imul    ax,ax
  1594.         add    ax,bx
  1595.         mov    status,ax
  1596.         fild    status
  1597.         fsqrt
  1598.         fistp    word ptr fs:[di]
  1599.  
  1600.         cmp    cx,0
  1601.         jne    @@notzero
  1602.         cmp    dx,0
  1603.         jge    @@ygr0
  1604.         mov    al,64+128
  1605.         jmp    @@storedeg
  1606.  
  1607. @@ygr0:        mov    al,64
  1608.         jmp    @@storedeg
  1609. @@notzero:
  1610.         mov    status,dx
  1611.         fild    status
  1612.         mov    status,cx
  1613.         fild    status
  1614.         fpatan
  1615.         fmul    sz255
  1616.         fldpi
  1617.         fadd    st,st
  1618.         fdiv
  1619.         fistp    status
  1620.         mov    ax,status
  1621. @@storedeg:    mov    es:[di],al
  1622.  
  1623.         inc    di
  1624.         inc    cx
  1625.         cmp    cx,160
  1626.         jne    @@xloop
  1627.         inc    dx
  1628.         cmp    dx,100
  1629.         jne    @@yloop
  1630.  
  1631.         load    es,@multabseg
  1632.         xor    di,di
  1633.  
  1634.         mov    bx,0
  1635. @@yloop2:    mov    cx,-127
  1636. @@xloop2:    mov    ax,cx
  1637.         imul    bx
  1638.         shrd    ax,dx,7
  1639.         add    al,128
  1640.         stosb
  1641.         inc    cx
  1642.         cmp    cx,128
  1643.         jle    @@xloop2
  1644.         inc    bx
  1645.         cmp    bx,256
  1646.         jbe    @@yloop2
  1647.  
  1648.         ret
  1649.  
  1650. initwave    endp
  1651.  
  1652. oldint8         dd      ?
  1653.  
  1654. ;────────────────────────────────────────────────────────────────────────
  1655. ;
  1656. newint8         proc    near
  1657. ;────────────────────────────────────────────────────────────────────────
  1658.  
  1659.         push    ds
  1660.  
  1661.         load    ds,@data
  1662.         inc     ds:timer
  1663.  
  1664.  
  1665.         cmp    ds:fadeinval,128
  1666.         je    @@1
  1667.         inc    ds:fadeinval
  1668. @@1:        cmp    ds:fadeoutval,0
  1669.         je    @@2
  1670.         dec    ds:fadeoutval
  1671. @@2:
  1672.  
  1673.         pop     ds
  1674.         jmp     dword ptr cs:oldint8
  1675.  
  1676. newint8         endp
  1677.  
  1678. ;────────────────────────────────────────────────────────────────────────
  1679. ;
  1680. gensintable     proc    near
  1681. ;────────────────────────────────────────────────────────────────────────
  1682.  
  1683.         xor     edi,edi
  1684.         mov     ebx,65535
  1685.         mov     ebp,2*804
  1686.  
  1687.         xor     si,si
  1688.         mov     cx,320
  1689.  
  1690. @@singen:       mov     eax,edi
  1691.         shr     eax,8
  1692.         mov     sintable[si],ax
  1693.  
  1694.         inc     si
  1695.         inc     si
  1696.  
  1697.         mov     eax,edi
  1698.         imul    ebp
  1699.         shrd    eax,edx,16
  1700.         sub     ebx,eax
  1701.         mov     eax,ebx
  1702.         imul    ebp
  1703.         shrd    eax,edx,16
  1704.         add     edi,eax
  1705.  
  1706.         loop    @@singen
  1707.  
  1708.         ret
  1709.  
  1710.  
  1711. gensintable     endp
  1712.  
  1713. ;────────────────────────────────────────────────────────────────────────
  1714. drawmaze        proc    near
  1715. ;────────────────────────────────────────────────────────────────────────
  1716.  
  1717.         xor     bx,bx
  1718.         mov     di,32000+160-2
  1719.  
  1720. @@draw:         push    bx
  1721.  
  1722.         mov     ax,dist[bx]
  1723.         mov     si,angle
  1724.         add     si,si
  1725.         mov     cx,costable[si]
  1726.         push    ax
  1727.         imul    cx
  1728.         shrd    ax,dx,8
  1729.         mov     cx,ax
  1730.         mov     bp,ax
  1731.         neg     bp
  1732.  
  1733.  
  1734.         pop     ax
  1735.         mov     bx,sintable[si]
  1736.         imul    bx
  1737.         shrd    ax,dx,8
  1738.         mov     dx,ax
  1739.         mov     si,ax
  1740.  
  1741.         shl     cx,8
  1742.         shl     dx,8
  1743.         add     ch,xpos
  1744.         add     dh,ypos
  1745.  
  1746.         push    ds
  1747.         load    ds,@mazeseg
  1748.  
  1749.         std
  1750.         push    di cx dx
  1751.         rept    80
  1752.  
  1753.             mov     bl,ch
  1754.             mov     bh,dh
  1755.             mov     ah,[bx]
  1756.             add     cx,si
  1757.             add     dx,bp
  1758.             mov     bl,ch
  1759.             mov     bh,dh
  1760.             mov     al,[bx]
  1761.             add     cx,si
  1762.             add     dx,bp
  1763.             stosw
  1764.  
  1765.         endm
  1766.         pop     dx cx di
  1767.  
  1768.         inc     di
  1769.         inc     di
  1770.  
  1771.         cld
  1772.         rept    80
  1773.  
  1774.             sub     cx,si
  1775.             sub     dx,bp
  1776.             mov     bl,ch
  1777.             mov     bh,dh
  1778.             mov     al,[bx]
  1779.             sub     cx,si
  1780.             sub     dx,bp
  1781.             mov     bl,ch
  1782.             mov     bh,dh
  1783.             mov     ah,[bx]
  1784.             stosw
  1785.  
  1786.         endm
  1787.  
  1788.         pop     ds
  1789.  
  1790.         add     di,160-2
  1791.  
  1792.         pop     bx
  1793.  
  1794.         inc     bx
  1795.         inc     bx
  1796.         cmp     bx,200
  1797.         jb      @@draw
  1798.  
  1799.  
  1800.         mov     di,32000-320
  1801.         mov     cx,320
  1802. @@3d:           push    di
  1803. @@1:            mov     dl,10
  1804.         mov     bl,es:[di]
  1805.         dec     bl
  1806.  
  1807. @@2:            add     di,320
  1808.         cmp     di,64000
  1809.         ja      @@endrow
  1810.         mov     al,es:[di]
  1811.         or      al,al
  1812.         jnz     @@1
  1813.  
  1814.         or      dl,dl
  1815.         jz      @@2
  1816.         dec     dl
  1817.  
  1818.         mov     es:[di],bl
  1819.         sub     bl,2
  1820.  
  1821.  
  1822.         jmp     @@2
  1823.  
  1824. @@endrow:       pop     di
  1825.         inc     di
  1826.         cmp     di,32320
  1827.         jb      @@3d
  1828.  
  1829.         ret
  1830.  
  1831. drawmaze        endp
  1832.  
  1833. ;────────────────────────────────────────────────────────────────────────
  1834. genmaze         proc    near
  1835. ;────────────────────────────────────────────────────────────────────────
  1836.  
  1837.         load    es,@mazeseg
  1838.         load    ds,es
  1839.  
  1840.         mov     di,32768
  1841.         xor     cx,cx
  1842. @@pixloop:
  1843.         mov     ax,di
  1844. @@randseed:     imul    ax,01234h
  1845.         add     ax,di
  1846.         mov     word ptr cs:@@randseed+2,ax
  1847.  
  1848.         sar     ax,0Ch
  1849.         inc     ax
  1850.  
  1851.         mov     ah,es:[di-256]
  1852.         add     ah,es:[di-257]
  1853.         rcr     ah,1
  1854.         add     al,ah
  1855.         and     al,127
  1856.         add     al,128
  1857.         stosb
  1858.         loop    @@pixloop
  1859.  
  1860.         std
  1861.         mov     di,65535
  1862.         mov     si,32767
  1863.         mov     dl,128
  1864. @@row2:         mov     cx,256
  1865.         rep     movsb
  1866.         add     si,256
  1867.         mov     cx,256
  1868.         rep     movsb
  1869.         dec     dl
  1870.         jnz     @@row2
  1871.  
  1872.         mov     dx,65536-256
  1873.         mov     bx,256
  1874.         call    alias
  1875.  
  1876.         cld
  1877.         load    ds,cs
  1878.         lea     si,mazedat
  1879.         xor     di,di
  1880.         mov     dl,16
  1881. @@gen:          lodsw
  1882.         mov     bx,ax
  1883.         xor     ax,ax
  1884.  
  1885.         mov     bp,16
  1886. @@line:         rcl     bx,1
  1887.         jnc     @@notblack
  1888.         push    di
  1889.  
  1890.         mov     dh,16
  1891. @@row:          mov     cx,8
  1892.         rep     stosw
  1893.         add     di,256-16
  1894.         dec     dh
  1895.         jnz     @@row
  1896.  
  1897.         pop     di
  1898.  
  1899. @@notblack:     add     di,16
  1900.         dec     bp
  1901.         jnz     @@line
  1902.  
  1903.         add     di,256*15
  1904.         dec     dl
  1905.         jnz     @@gen
  1906.  
  1907.  
  1908.         load    ds,@data
  1909.         xor     bx,bx
  1910.         mov     cx,30
  1911. @@gendist:      mov     ax,256*50
  1912.         cwd
  1913.         idiv    cx
  1914.         mov     dist[bx],ax
  1915.         inc     cx
  1916.         inc     bx
  1917.         inc     bx
  1918.         cmp     bx,200
  1919.         jnz     @@gendist
  1920.  
  1921.  
  1922.         ret
  1923.  
  1924. genmaze         endp
  1925.  
  1926. ;────────────────────────────────────────────────────────────────────────
  1927. genclouds       proc    near
  1928. ;────────────────────────────────────────────────────────────────────────
  1929.  
  1930.         load    ds,@data
  1931.         load    fs,@clouds
  1932.  
  1933.         lea     di,ds:palette
  1934.  
  1935.         load    es,ds
  1936.         mov     cx,768
  1937.         xor     ax,ax
  1938.         rep     stosb
  1939.  
  1940.         call    setpalette
  1941.  
  1942.         load    es,0a000h
  1943.  
  1944.         mov     cx,100
  1945.         mov     linexstart,0
  1946.         mov     linexend,639
  1947. @@backloop:     mov     liney,cx
  1948.         mov     ax,cx
  1949.         shr     ax,1
  1950.         add     al,10
  1951.         mov     color,al
  1952.         call    horizline
  1953.         dec     cx
  1954.         jns     @@backloop
  1955.  
  1956.         mov     bp,150
  1957. @@cloudloop:    mov     ax,640-20
  1958.         lea     bx,random
  1959.         call    bx
  1960.         add     ax,10
  1961.         mov     xc,ax
  1962.         mov     ax,80
  1963.         call    bx
  1964.         add     ax,10
  1965.         mov     yc,ax
  1966.         mov     ax,10
  1967.         call    bx
  1968.         inc     ax
  1969.         mov     radius,ax
  1970.         mov     ax,50
  1971.         call    bx
  1972.         add     al,30
  1973.         mov     color,al
  1974.         call    filledcircle
  1975.         dec     bp
  1976.         jnz     @@cloudloop
  1977.  
  1978.         call    copy
  1979.  
  1980.         load    es,0a000h
  1981.  
  1982.         xor     di,di
  1983. @@smearlooprow: xor     bx,bx
  1984.         mov     dh,0
  1985. @@smearloopcol: mov     si,di
  1986.         add     si,bx
  1987.         mov     dl,fs:[si]
  1988.         mov     cl,dh
  1989.         shr     cl,1
  1990.         add     cl,10
  1991.         cmp     dl,cl
  1992.         je      @@marad
  1993.         mov     ax,50
  1994.         call    random
  1995.         add     dl,al
  1996. @@marad:        mov     ax,31
  1997.         call    random
  1998.         sub     ax,15
  1999.         add     si,ax
  2000.         mov     es:[si],dl
  2001.         add     bx,640
  2002.         inc     dh
  2003.         cmp     dh,100
  2004.         jb      @@smearloopcol
  2005.  
  2006.         inc     di
  2007.         cmp     di,640
  2008.         jb      @@smearlooprow
  2009.  
  2010.         call    copy
  2011.  
  2012.         push    ds
  2013.         load    ds,fs
  2014.         load    es,0a000h
  2015.         mov     bx,640
  2016.         mov     dx,64000-640
  2017.         call    alias
  2018.         call    alias
  2019.         pop     ds
  2020.  
  2021.         call    copy
  2022.  
  2023.         load    es,0a000h
  2024.         xor     di,di
  2025.         mov     cx,32000
  2026.         xor     ax,ax
  2027.         rep     stosw
  2028.  
  2029.         lea    si,cs:mazepal
  2030.         call    fillpalette
  2031.  
  2032.         ret
  2033.  
  2034. genclouds       endp
  2035.  
  2036. ;────────────────────────────────────────────────────────────────────────
  2037. genlogo         proc    near
  2038. ;─────────────────────────────────────────────────────────────────────────
  2039.  
  2040.         mov    cs:randseed,35212
  2041.  
  2042.         lea     di,ds:palette
  2043.  
  2044.         load    es,ds
  2045.         mov     cx,768
  2046.         xor     ax,ax
  2047.         rep     stosb
  2048.  
  2049.         call    setpalette
  2050.  
  2051.         push    ds es
  2052.  
  2053.         push    cs
  2054.         pop     ds
  2055.  
  2056.         push    0a000h
  2057.         pop     es
  2058.  
  2059.         lea     si,logo
  2060.         mov     di,40+85*320
  2061.  
  2062.         mov     dh,15
  2063. @@col:
  2064.         mov     dl,15
  2065. @@row:          lodsb
  2066.         mov     bh,al
  2067.         mov     cx,8
  2068. @@byte:         xor     ax,ax
  2069.         rcl     bh,1
  2070.         jnc     @@black
  2071.         mov     ax,0ffffh
  2072.         call    random
  2073.         and     ax,7f7fh
  2074.  
  2075. @@black:        mov     es:[di+320],ax
  2076.         stosw
  2077.         loop    @@byte
  2078.  
  2079.         dec     dl
  2080.         jnz     @@row
  2081.  
  2082.         add     di,320+320-120*2
  2083.         dec     dh
  2084.         jnz     @@col
  2085.  
  2086. @@alias:        push    es
  2087.         pop     ds
  2088.         mov     dx,3
  2089.  
  2090. @@aliasonce:
  2091.         xor     ah,ah
  2092.         xor     di,di
  2093.         mov     si,di
  2094.  
  2095.         mov     bp,160
  2096. @@aliaschar:    mov     cx,320
  2097.  
  2098. @@aliasrow:     lodsb
  2099.         add     al,es:[si]
  2100.         adc     ah,0
  2101.         add     al,es:[si+319]
  2102.         adc     ah,0
  2103.         add     al,es:[si+320]
  2104.         adc     ah,0
  2105.         shr     ax,2
  2106.         stosb
  2107.         loop    @@aliasrow
  2108.  
  2109.         dec     bp
  2110.         jnz     @@aliaschar
  2111.  
  2112.         dec     dx
  2113.         jnz     @@aliasonce
  2114.  
  2115.         pop     es ds
  2116.  
  2117.         lea    si,cs:logopal
  2118.         call    fillpalette
  2119.  
  2120.         xor    bp,bp
  2121.         mov    bx,64
  2122. @@fadein:    call    waitrtc
  2123.         call    fade
  2124.         inc    bp
  2125.         inc    bp
  2126.         dec    bx
  2127.         jnz    @@fadein
  2128.  
  2129.         mov    timer,0
  2130. @@wait:        cmp    timer,100
  2131.         jb    @@wait
  2132.  
  2133.         mov    bx,64
  2134. @@fadeout:    call    waitrtc
  2135.         call    fade
  2136.         dec    bp
  2137.         dec    bp
  2138.         dec    bx
  2139.         jnz    @@fadeout
  2140.  
  2141.         ret
  2142.  
  2143. genlogo         endp
  2144.  
  2145. ;────────────────────────────────────────────────────────────────────────
  2146. alias           proc    near
  2147. ;────────────────────────────────────────────────────────────────────────
  2148.  
  2149.         mov     di,bx
  2150. @@aliasloop:    xor     cx,cx
  2151.         mov     cl,[di]
  2152.         shl     cx,2
  2153.         mov     ax,cx
  2154.         mov     cl,[di+1]
  2155.         mov     ch,0
  2156.         shl     cx,1
  2157.         add     ax,cx
  2158.         mov     cl,[di-1]
  2159.         mov     ch,0
  2160.         shl     cx,1
  2161.         add     ax,cx
  2162.         mov     cl,[di+bx]
  2163.         mov     ch,0
  2164.         shl     cx,1
  2165.         add     ax,cx
  2166.         mov     cl,[di-bx]
  2167.         mov     ch,0
  2168.         shl     cx,1
  2169.         add     ax,cx
  2170.         mov     cl,[di-bx-1]
  2171.         mov     ch,0
  2172.         add     ax,cx
  2173.         mov     cl,[di-bx+1]
  2174.         add     ax,cx
  2175.         mov     cl,[di+bx+1]
  2176.         add     ax,cx
  2177.         mov     cl,[di+bx-1]
  2178.         add     ax,cx
  2179.         shr     ax,4
  2180.         mov     es:[di],al
  2181.         inc     di
  2182.         cmp     di,dx
  2183.         jb      @@aliasloop
  2184.         ret
  2185.  
  2186. alias           endp
  2187.  
  2188. ;────────────────────────────────────────────────────────────────────────
  2189. copy            proc    near
  2190. ;────────────────────────────────────────────────────────────────────────
  2191.  
  2192.         push    ds
  2193.         load    es,fs
  2194.         load    ds,0a000h
  2195.         xor     si,si
  2196.         xor     di,di
  2197.         mov     cx,32000
  2198.         rep     movsw
  2199.         pop     ds
  2200.  
  2201.         ret
  2202. copy            endp
  2203.  
  2204. ;────────────────────────────────────────────────────────────────────────
  2205. filledcircle    proc    near
  2206. ;────────────────────────────────────────────────────────────────────────
  2207.  
  2208.         xor     bx,bx
  2209.         mov     cx,radius
  2210.         mov     dx,cx
  2211.         shl     dx,1
  2212.         neg     dx
  2213.         add     dx,3
  2214.  
  2215. @@circloop:     cmp     bx,cx
  2216.         jge     @@vege
  2217.  
  2218.         call    @@circline
  2219.         cmp     dx,0
  2220.         jge     @@1
  2221.  
  2222.         mov     ax,bx
  2223.         shl     ax,2
  2224.         add     ax,6
  2225.         add     dx,ax
  2226.         jmp     @@ki
  2227. @@1:            mov     ax,bx
  2228.         sub     ax,cx
  2229.         shl     ax,2
  2230.         add     ax,10
  2231.         add     dx,ax
  2232.  
  2233.         dec     cx
  2234. @@ki:           inc     bx
  2235.         jmp     @@circloop
  2236.  
  2237.  
  2238. @@vege:         cmp     bx,cx
  2239.         jne     @@vege2
  2240.  
  2241. @@circline:
  2242.         mov     ax,yc
  2243.         sub     ax,cx
  2244.         mov     liney,ax
  2245.         mov     ax,xc
  2246.         sub     ax,bx
  2247.         mov     linexstart,ax
  2248.         mov     ax,xc
  2249.         add     ax,bx
  2250.         mov     linexend,ax
  2251.         call    horizline
  2252.  
  2253.         mov     ax,yc
  2254.         add     ax,cx
  2255.         mov     liney,ax
  2256.         call    horizline
  2257.         mov     ax,yc
  2258.         sub     ax,bx
  2259.         mov     liney,ax
  2260.         mov     ax,xc
  2261.         sub     ax,cx
  2262.         mov     linexstart,ax
  2263.         mov     ax,xc
  2264.         add     ax,cx
  2265.         mov     linexend,ax
  2266.         call    horizline
  2267.  
  2268.         mov     ax,yc
  2269.         add     ax,bx
  2270.         mov     liney,ax
  2271.         call    horizline
  2272.  
  2273. @@vege2:        ret
  2274.  
  2275. filledcircle    endp
  2276.  
  2277. ;────────────────────────────────────────────────────────────────────────
  2278. horizline       proc    near
  2279. ;────────────────────────────────────────────────────────────────────────
  2280.  
  2281.         pusha
  2282.         mov     bx,linexstart
  2283.  
  2284.         mov     di,liney
  2285.         mov     ax,di
  2286.         shl     di,9
  2287.         shl     ax,7
  2288.         add     di,ax
  2289.         add     di,bx
  2290.  
  2291.         mov     cx,linexend
  2292.         sub     cx,bx
  2293.         inc     cx
  2294.         mov     al,color
  2295.         rep     stosb
  2296.         popa
  2297.  
  2298.         ret
  2299.  
  2300. horizline       endp
  2301.  
  2302. ;────────────────────────────────────────────────────────────────────────
  2303. sky             proc    near
  2304. ;────────────────────────────────────────────────────────────────────────
  2305.  
  2306.         mov     bx,skyxstart
  2307.         push    ds
  2308.         load    ds,@clouds
  2309.         mov     bp,100
  2310.         xor     di,di
  2311. @@skyloop:      mov     si,bx
  2312.         mov    cx,320
  2313.         rep    movsb
  2314.  
  2315.         add     bx,640
  2316.         dec     bp
  2317.         jnz     @@skyloop
  2318.  
  2319.         pop     ds
  2320.         ret
  2321.  
  2322. sky             endp
  2323.  
  2324. ;────────────────────────────────────────────────────────────────────────
  2325. fillpalette     proc    near
  2326. ;────────────────────────────────────────────────────────────────────────
  2327.         cld
  2328.         push    ds es
  2329.         load    es,ds
  2330.         load    ds,cs
  2331.         lea    di,palette
  2332.  
  2333.         xor    ax,ax
  2334.         stosw
  2335.         stosb
  2336. @@set:        lodsw
  2337.         xchg    cx,ax
  2338.         jcxz    @@end
  2339.         lodsw
  2340.         xchg    bx,ax
  2341.         lodsw
  2342.         xchg    dx,ax
  2343.         lodsw
  2344. @@col:        mov    es:[di],bh
  2345.         mov    es:[di+1],dh
  2346.         mov    es:[di+2],ah
  2347.  
  2348.         add    bx,[si]
  2349.         add    dx,[si+2]
  2350.         add    ax,[si+4]
  2351.  
  2352.         add    di,3
  2353.         loop    @@col
  2354.  
  2355.         add    si,6
  2356.         jmp    @@set
  2357.  
  2358.  
  2359. @@end:        pop    es ds
  2360.         ret
  2361.  
  2362. fillpalette     endp
  2363.  
  2364. ;────────────────────────────────────────────────────────────────────────
  2365. setpalette      proc    near
  2366. ;────────────────────────────────────────────────────────────────────────
  2367.  
  2368.         lea    si,palette
  2369.         mov     dx,03c8h
  2370.         xor     al,al
  2371.         out     dx,al
  2372.         inc     dl
  2373.         mov     cx,768
  2374.         rep     outsb
  2375.  
  2376.         ret
  2377.  
  2378. setpalette      endp
  2379.  
  2380. ;────────────────────────────────────────────────────────────────────────
  2381. fade         proc    near
  2382. ;────────────────────────────────────────────────────────────────────────
  2383.  
  2384.         cld
  2385.         lea     si,ds:palette
  2386.         mov     dx,03c8h
  2387.         xor     ax,ax
  2388.         out     dx,al
  2389.         inc     dl
  2390.         mov     cx,768
  2391. @@3:            lodsb
  2392.         imul    ax,bp
  2393.         shr     ax,7
  2394.         out     dx,al
  2395.         loop    @@3
  2396.  
  2397.         ret
  2398.  
  2399. fade        endp
  2400.  
  2401. ;────────────────────────────────────────────────────────────────────────
  2402. drawvirt        proc     near
  2403. ;────────────────────────────────────────────────────────────────────────
  2404.  
  2405.         call    waitrtc
  2406.  
  2407.         push    ds
  2408.         load    es,0a000h
  2409.         load    ds,@virtscr
  2410.         xor     si,si
  2411.         xor     di,di
  2412.         mov     cx,32000
  2413.         rep     movsw
  2414.         pop     ds
  2415.  
  2416.         ret
  2417.  
  2418. drawvirt        endp
  2419.  
  2420. ;────────────────────────────────────────────────────────────────────────
  2421. waitrtc        proc    near
  2422. ;────────────────────────────────────────────────────────────────────────
  2423.  
  2424.         cli
  2425.         mov     dx,3dah
  2426. @@wait1:
  2427.         in     al,dx
  2428.         test     al,08h
  2429.         jz     @@wait1
  2430. @@wait2:
  2431.         in     al,dx
  2432.         test    al,08h
  2433.         jnz      @@wait2
  2434.         sti
  2435.         ret
  2436.  
  2437. waitrtc        endp
  2438.  
  2439. ;────────────────────────────────────────────────────────────────────────
  2440. random          proc     near
  2441. ;────────────────────────────────────────────────────────────────────────
  2442.  
  2443.         push    bx cx dx
  2444.         mov     cx,ax
  2445.         mov     ax,75
  2446.         mov     bx,cs:randseed
  2447.         mul     bx
  2448.         add     ax,74
  2449.         sbb     ax,dx
  2450.         mov     cs:randseed,ax
  2451.         xor     dx,dx
  2452.         div     cx
  2453.         mov     ax,dx
  2454.         pop     dx cx bx
  2455.         ret
  2456.  
  2457. random          endp
  2458.  
  2459. randseed        dw      0
  2460.  
  2461. ;████████████████████████████████████████████████████████████████████████
  2462.  
  2463.  
  2464. ;────────────────────────────────────────────────────────────────────────
  2465.  
  2466. mazedat         dw      1000100100000100b
  2467.         dw      1110101111010111b
  2468.         dw      0000101001010000b
  2469.         dw      1011101101011011b
  2470.         dw      1000100100000010b
  2471.         dw      1011110101111010b
  2472.         dw      1000010001000010b
  2473.         dw      1101010111101110b
  2474.         dw      0001010100000000b
  2475.         dw      0111011110111111b
  2476.         dw      0000000000100000b
  2477.         dw      1111011011101111b
  2478.         dw      0100000000001000b
  2479.         dw      0101111011111101b
  2480.         dw      0000001010000001b
  2481.         dw      1111101111101101b
  2482.  
  2483. ;────────────────────────────────────────────────────────────────────────
  2484. logo    label byte
  2485.  
  2486.  db 2,2,0,2,0,152,17,252,0,8,4,128,0,16,0,2,135,0,7,0
  2487.  db 80,28,127,128,28,3,0,0,56,0,7,134,0,7,32,120,8,56,192,28
  2488.  db 131,0,0,57,0,7,142,0,47,64,124,24,48,32,189,7,0,1,122,0
  2489.  db 7,207,0,27,128,50,24,48,48,110,7,64,0,220,0,15,203,64,9,128
  2490.  db 51,24,48,80,38,3,128,0,76,0,13,217,128,17,200,49,184,48,16,71
  2491.  db 33,128,0,142,64,44,209,0,16,240,113,176,32,16,67,193,128,0,135,128
  2492.  db 24,240,160,255,224,48,176,32,51,255,133,128,7,255,0,24,240,192,54,224
  2493.  db 52,244,40,80,219,131,160,1,183,0,60,224,192,32,224,56,120,112,16,131
  2494.  db 129,192,1,7,0,56,112,192,64,112,120,112,96,49,1,193,192,2,3,128
  2495.  db 48,112,96,64,112,112,48,96,225,1,193,132,66,3,128,116,120,104,208,120
  2496.  db 240,49,127,195,65,227,248,198,131,192,248,236,241,240,204,152,120,255
  2497.  db 7,195,51,255,143,134,96
  2498.  
  2499. ;────────────────────────────────────────────────────────────────────────
  2500.  
  2501. cubes        dw     100, 100, 100
  2502.         dw    -100,-100,-100
  2503.         dw    -100, 100, 100
  2504.         dw     100,-100, 100
  2505.         dw     100, 100,-100
  2506.         dw    -100,-100, 100
  2507.         dw     100,-100,-100
  2508.         dw    -100, 100,-100
  2509.  
  2510.         dw     50, 50, 50
  2511.         dw    -50, 50, 50
  2512.         dw     50,-50, 50
  2513.         dw     50, 50,-50
  2514.         dw    -50,-50, 50
  2515.         dw     50,-50,-50
  2516.         dw    -50, 50,-50
  2517.         dw    -50,-50,-50
  2518.         dw    0,0,0
  2519.  
  2520. ;────────────────────────────────────────────────────────────────────────
  2521.  
  2522. logopal        dw      48,103,114,163,103,114,163
  2523.         dw    55,4944,5472,7824,204,195,153
  2524.         dw    0
  2525.  
  2526. mazepal        dw    127,17*256,14*256,34*256,46*2,49*2,29*2
  2527.         dw    128,24*256,4*256,0,78,118,126
  2528.         dw    0
  2529.  
  2530. mandalapal    dw      127,13*256,10*256,26*256,100,102,74
  2531.         dw    128,63*256,63*256,63*256,-100,-102,-74
  2532.         dw    0
  2533.  
  2534. firepal         dw    63,256,57,0,256,57,0
  2535.         dw    64,63*256,14*256,0,-8,142,85
  2536.         dw    64,61*256,49*256,21*256,8,57,171
  2537.         dw    64,0,14*256,26*256,252,199,150
  2538.         dw    0
  2539.  
  2540. stripepal       dw    143,5376,512,512,68,81,18
  2541.         dw    0
  2542.  
  2543.  
  2544. end                main
  2545.